<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>生成短链</title>
    <script type="text/javascript" src="../lib/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        function generateShortUrl() {
            var originUrl = $('#originUrl').val();
            var ak = $('#ak').val();
            var sk = $('#sk').val();
            var params = {
                url: originUrl,
                accessKey: ak,
                accessSecret: sk
            }

            var reqUrl = 'https://panda.zhoupudata.com/api/s/add';
            $.post(reqUrl, params, function (result) {
                if(result.code === 0) {
                    $('#result').val(result.data);
                }else{
                    $('#result').val("生成错误！");
                }
            })
        }

    </script>
</head>
<body>
<h5>生成短链</h5>
ak:<br>
<input id="ak" style="width: 100%;"/><br>
sk:<br>
<input id="sk" style="width: 100%;"/><br>
原始url:<br>
<textarea id="originUrl" style="width: 100%;height: 100px"></textarea><br>
<button onclick="generateShortUrl()">生成</button>
<br><br>
结果：<br>
<input id="result" style="width: 100%;"/>

</body>
</html>

